const mongoose = require('mongoose');

mongoose.connect("mongodb://wp0214:wang3588829@ds247944.mlab.com:47944/myblog",{useNewUrlParser: true})

const db = mongoose.connection;

db.on('error', (error) => {
    console.log("数据库连接失败：" + error);
})

db.on("open", function () {
    console.log("------数据库连接成功！------");
});

module.exports = db;